package com.lida.easyExcel.controller;

import com.lida.commonuntils.R;
import com.lida.easyExcel.service.ExcelService;
import com.lida.zwservice.entity.DetailedVo;
import com.lida.zwservice.entity.ExcelDetailedVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import static com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation.ANONYMOUS.required;

@RestController
@RequestMapping("/tools/easyExcel")
@CrossOrigin
public class ExcelController {

    @Autowired
    private ExcelService easyExcel;

    @PostMapping("/wirte")
    public R write(@RequestBody(required=false) DetailedVo detaile){
        easyExcel.writeExcel(detaile);
        return R.success();
    }

    @PostMapping("/getExcellist/{page}/{limit}")
    public R getExcellist(@PathVariable long page, @PathVariable long limit,
                          @RequestBody ExcelDetailedVo excelVo){
        R list = easyExcel.getList(page, limit, excelVo);

        return R.success().data("list",list);
    }

}
